"use client"

import { WagmiProvider } from "wagmi";
import { RainbowKitProvider, getDefaultConfig } from "@rainbow-me/rainbowkit";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { mainnet, sepolia } from 'wagmi/chains'
import "@rainbow-me/rainbowkit/styles.css";

const config = getDefaultConfig({
  appName: "My Dapp",
  projectId: "YOUR_WALLETCONNECT_PROJECT_ID", // 去 walletconnect cloud 免费注册一个
  chains: [mainnet, sepolia],
});

const queryClient = new QueryClient();

export function WagmiClientProvider({ children }) {
  return (
    <WagmiProvider config={config}>
        <QueryClientProvider client={queryClient}>
            <RainbowKitProvider>
              {children}
            </RainbowKitProvider>
        </QueryClientProvider>
    </WagmiProvider>
  );
}
